package cn.tedu.basic;

import sun.font.FontRunIterator;

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

public class Test2 {
    public static void main(String[] args) throws IOException {
        //读取数据并存入list里
        InputStream In =new BufferedInputStream(new FileInputStream("D:\\a\\b\\2.txt"));
        int a =In.read();
        System.out.println(a);
        int b =0;
        List<Integer> l =new ArrayList();
        while ((b=In.read())!=-1){
            l.add(b);
        }
        In.close();
        System.out.println(l);

        //给list集合里的数据去重
        Object[] o = l.toArray();
        List l1 =new ArrayList();
        for (int i = 0; i <l.size() ; i++) {
            for (int j = 0; j <l.size() ; j++) {
                if (l.get(i)==l.get(j)){
                    l.remove(j);
                }
            }
            System.out.println(l.get(i));
        }
        //给list集合里的数据去重
        List<Integer> lt =new ArrayList();
        for (int i = 0; i <20 ; i++) {
            int it =new Random().nextInt(100);
            if (! lt.contains(it)){
                lt.add(it);
            }
        }
        System.out.println(lt);

    }

}
